<?php
function getContact($id,$s=true)
{
	$mrs= mysql_query("select * from member where id=".$id);	
	$m_row=mysql_fetch_array($mrs);
	if($m_row["m_type"]==6)
	{
		$m_url4="http://".$m_row[m_user].".sandib2b.cn/product-list/1.htm";
	}
	else
	{
		$m_url4="http://sandib2b.cn/cn/template/".$m_row[m_user]."/product-list/1.html";
	}
	$re = '<table border="0" align="center" cellpadding="4" cellspacing="0" bgcolor="#E0E0E0">';
	if(trim($m_row[m_ts_tel]))
	{
  	$re.= '<tr><td align="center" bgcolor="#FFFFFF"><img src="http://sandib2b.cn/images/tel.gif" width="22" height="17" /></td><td align="left" bgcolor="#FFFFFF" style="font-family: Arial, Helvetica, sans-serif;color:red">'.$m_row[m_ts_tel].'</td></tr>';
	} 

	if($m_row[m_tel]) 
	{
		$m_row[m_tel] = preg_replace('/(^86-)|(^086-)/','',$m_row[m_tel]); 
 	$re.=  '<tr><td align="center" bgcolor="#FFFFFF"><img src="http://sandib2b.cn/images/tel.gif" width="22" height="17" /></td><td align="left" bgcolor="#FFFFFF" style="font-family: Arial, Helvetica, sans-serif;">'.$m_row[m_tel].' &nbsp;'.$m_row[m_tel_n].'</td></tr>';
	 } 

	if($m_row[m_tel2]) 
	{
		$m_row[m_tel2] = preg_replace('/^86-/','',$m_row[m_tel2]); 
  	$re.= '<tr><td align="center" bgcolor="#FFFFFF"><img src="http://sandib2b.cn/images/tel.gif" width="22" height="17" /></td><td align="left" bgcolor="#FFFFFF" style="font-family: Arial, Helvetica, sans-serif;">'.$m_row[m_tel2].' &nbsp;'.$m_row[m_tel2_n].'</td></tr>';
	}

	if($m_row[m_tel3]) 
	{
		$m_row[m_tel3] = preg_replace('/^86-/','',$m_row[m_tel3]);
  	$re.= '<tr><td align="center" bgcolor="#FFFFFF"><img src="http://sandib2b.cn/images/tel.gif" width="22" height="17" /></td><td align="left" bgcolor="#FFFFFF" style="font-family: Arial, Helvetica, sans-serif;">'.$m_row[m_tel3].' &nbsp;'.$m_row[m_tel3_n].'</td></tr>';
	} 

	if(trim($m_row[m_phone])) 
	{ 
  	$re.= '<tr><td align="center" bgcolor="#FFFFFF"><img src="http://sandib2b.cn/images/phone.gif" width="15" height="21" /></td><td align="left" bgcolor="#FFFFFF" style="font-family: Arial, Helvetica, sans-serif;">'.$m_row[m_phone].'</td></tr>';
	} 
	if($m_row[m_qq]) 
	{
		preg_match('/(\d{5,12})/',$m_row[m_qq],$res);
		$m_row["m_qq"]=$res[0];
	$re.= '<tr><td colspan="2" align="center" bgcolor="#FFFFFF"><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin='.$m_row["m_qq"].'&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:'.$m_row["m_qq"].':41" alt="点击这里给我发消息" title="点击这里给我发消息"></a></td></tr>';
	} 
	
	if($s)
	{
		$re.= '<tr><td colspan="2" align="center" bgcolor="#FFFFFF"><a href="'.$m_url4.'" target="_blank"><img src="http://sandib2b.cn/images/contact_2.gif" alt="联系方式-'.$m_row['m_cname'].'" width="120" height="29" border="0" /></a></td></tr>';
	}
	$re.="</table>";	
	return $re;
}	
?>
